import SDKManager from "../../SDKManager";
import GameItemModel from "../../base/GameItemModel";
import RandomHelper from "../../../cfw/tools/RandomHelper";

// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const { ccclass, property } = cc._decorator;

@ccclass
export default class AdLiuCheng extends cc.Component {



    start() {
        // let matrix: MatrixMgr = SDKManager.getChannel().getMatrix()
        // if (matrix) {
        if (SDKManager.getChannel().isSwtichOpen()) {

            if (SDKManager.getChannel().getzs_video_delayed()) {
                SDKManager.getChannel().showInsertAd(0, () => {
                })
                SDKManager.getChannel().showRewardAd(0, (r: number) => {

                })
                let list = SDKManager.getChannel().getAdData();
                if (list) {
                    let model: GameItemModel = list[RandomHelper.random(0, list.length)]
                    if (model) {
                        SDKManager.getChannel().navigate2Mini(model)
                    }

                } else {

                }
            }


        }
        // }
    }

    // update (dt) {}
}
